//
// Created by liushuai on 2020/5/23.
//
#include "findMin.h"
int findMin(std::vector<int>& nums) {
<<<<<<< HEAD:cxx/algorithm/src/findMin.cc
    int upper = nums.size()-1;
    int lower = 0;
    while(lower<upper){
        int mid = lower+(upper-lower)/2;
        // 中间的元素应该小于高位的元素
        if(nums.at(mid)<nums.at(upper))
            upper = mid;
        else
            lower = mid+1;
    }
    return nums.at(lower);
}

=======
  int upper = nums.size() - 1;
  int lower = 0;
  while (lower < upper) {
    int mid = lower + (upper - lower) / 2;
    // 中间的元素应该小于高位的元素
    if (nums.at(mid) < nums.at(upper))
      upper = mid;
    else
      lower = mid + 1;
  }
  return nums.at(lower);
}
>>>>>>> dev:cxx/algorithm/common/src/findMin.cc
